
<!-- STRUCTURAL LINKS CONNECTING THE 3 PAGES BELONGING TO THE TOPIC PRODUCT: description, photogallery, datasheets -->

<div class="structuralLinks" xmlns="http://www.w3.org/1999/html">
  <%if(@designer!= nil) %>
    <h4 style="position:absolute; right:50px;">Description  &nbsp; <%= link_to 'Photo-gallery', photogallery_product_path(@product,:designer_id=>@designer.id) %> &nbsp; <%= link_to 'Datasheet', datasheet_product_path(@product,:designer_id=>@designer.id) %></h4>
  <%elsif(@title=="Must-have"||@title=="New")%>
    <h4 style="position:absolute; right:50px;">Description  &nbsp; <%= link_to 'Photo-gallery', photogallery_product_path(@product,:title=>@title) %> &nbsp; <%= link_to 'Datasheet', datasheet_product_path(@product,:title=>@title) %></h4>
  <%elsif(@product_type_id!=nil)%>
      <h4 style="position:absolute; right:50px;">Description  &nbsp; <%= link_to 'Photo-gallery', photogallery_product_path(@product,:product_type_id=>@product_type_id) %> &nbsp; <%= link_to 'Datasheet', datasheet_product_path(@product, :product_type_id=>@product_type_id) %></h4>
  <%else%>
    <h4 style="position:absolute; right:50px;">Description  &nbsp; <%= link_to 'Photo-gallery', photogallery_product_path(@product) %> &nbsp; <%= link_to 'Datasheet', datasheet_product_path(@product) %></h4>
  <%end%>
</div><br>

<!-- END OF THE STRUCTURAL LINKS -->



<!-- PRODUCT HEADER AND LINKS TO PREVIOUS AND NEXT PRODUCT IN THE GROUP (ONLY IF ARRIVING FROM NEW, MUST-HAVE OR PRODUCT'S OF A GIVEN DESIGNER) -->

<div>
    <hr style="clear:both;"/>
    <br>
    <div class="ProductHeader">
        <h1>  <%= @product.name %>
          <span>

            <%if(@designer!= nil) %>
                (
                <%= link_to "prev", product_path(@prev,:designer_id=>@designer.id) %>
                -
                <%= link_to "next", product_path(@next,:designer_id=>@designer.id) %>
                )
            <%elsif(@products!= nil)%>
                (
                <%= link_to "prev", product_path(@prev,:title=>@title) %>
                -
                <%= link_to "next", product_path(@next,:title=>@title) %>
                )
            <%end%>
          </span>
        </h1>



          <% if(@title!=nil) %>
              <h6> Designed by
                <% @designers.each do |designer| %>
                    <%= link_to designer.name, designer_path(designer,:product_id=>@product.id, :title=>@title) %>
                <% end  %> <br>
                Exposed in
                <% @events.each do |event| %>
                    <%= link_to event.name, event_path(event, :title=>@title) %>
                <% end  %> <br>
                <% if @partner !=nil %>
                    In partnership with
                    <%= link_to @partner.name, @partner.website %>
                <% end %>
                <br><br>
              <%= link_to 'Find this product', shops_for_this_product_product_path(@product, :title=>@title) %>
              </h6>

          <% elsif(@designer!=nil) %>
          <h6> Designed by
            <% @designers.each do |designer| %>
                <%= link_to designer.name, designer_path(designer,:product_id=>@product.id, :designer_id=>@designer.id) %>
            <% end  %> <br>
            Exposed in
            <% @events.each do |event| %>
                <%= link_to event.name, event_path(event, :designer_id=>@designer.id) %>
            <% end  %> <br>
            <% if @partner !=nil %>
                In partnership with
                <%= link_to @partner.name, @partner.website %>
            <% end %>
            <br><br>
          <%= link_to 'Find this product', shops_for_this_product_product_path(@product, :designer_id=>@designer.id) %>
          </h6>

          <% elsif(@product_type_id!=nil) %>
          <h6> Designed by
            <% @designers.each do |designer| %>
                <%= link_to designer.name, designer_path(designer,:product_id=>@product.id, :product_type_id=>@product_type_id) %>
            <% end  %> <br>
            Exposed in
            <% @events.each do |event| %>
                <%= link_to event.name, event_path(event, :product_type_id=>@product_type_id) %>
            <% end  %> <br>
            <% if @partner !=nil %>
                In partnership with
                <%= link_to @partner.name, @partner.website %>
            <% end %>
            <br><br>
              <%= link_to 'Find this product', shops_for_this_product_product_path(@product, :product_type_id=>@product_type_id) %>
          </h6>

          <% else %>
            <h6> Designed by
            <% @designers.each do |designer| %>
                <%= link_to designer.name, designer_path(designer,:product_id=>@product.id) %>
            <% end  %> <br>
            Exposed in
            <% @events.each do |event| %>
                <%= link_to event.name, event_path(event) %>
            <% end  %> <br>
            <% if @partner !=nil %>
                In partnership with
                <%= link_to @partner.name, @partner.website %>
            <% end %>
            <br><br>
            <%= link_to 'Find this product', shops_for_this_product_product_path(@product) %>
            </h6>
         <% end %>


    </div>

    <div class="mainProductImg">
    <%= image_tag("/products/#{@product.image_url}") %>
    </div>
  <br>
</div>

<!-- END OF PRODUCT HEADER -->



<div class="box1">
  <br>
  <hr style="clear:both;"/>
  <h3> Description </h3>
  <%= @product.description %>
  <br>
  <br>
</div>

<br>

<div class="box2">
  <hr style="clear:both;"/>
    <div class="gridList">
      <h3> Match this product</h3>
      <%@matches.each do |matching_product| %>
      <div class="gridBox">
        <%= matching_product.name %>
        <%= link_to product_path(matching_product) do%>
            <%= image_tag("/products/#{matching_product.image_url}") %>
        <% end %>
      </div>
      <% end %>
      <br>
      <br>
    </div>
</div>


 <!-- BACK LINKS-->

<div id="backLinkProduct">
  <div id="imageBack">
    <% if(@title=="All") %>

        <%= link_to "/products" do%>
            <%= image_tag("/back.png") %>
        <% end %>
        </div>
        <div id="textBack">
          Back to <%=@title%> products
        </div>
    <% elsif(@title=="Must-have") %>

        <%= link_to "/products?must=true" do%>
            <%= image_tag("/back.png") %>
        <% end %>
        </div>
        <div id="textBack">
          Back to <%=@title%> products
        </div>
    <% elsif(@title=="New") %>

        <%= link_to "/products?new=true" do%>
            <%= image_tag("/back.png") %>
        <% end %>
        </div>
        <div id="textBack">
          Back to <%=@title%> products
        </div>
    <% elsif(@designer!= nil) %>

        <%= link_to products_designer_path(@designer) do%>
            <%= image_tag("/back.png") %>
        <% end %>
        </div>
        <div id="textBack">
          Back to <%=@designer.name%>'s products
        </div>
    <% elsif(@product_type_id!=nil) %>

        <%= link_to products_path(:product_type_id=>@product_type_id) do%>
            <%= image_tag("/back.png") %>
        <% end %>
        </div>
        <div id="textBack">
          Back to "<%= @product_type.name %>"
        </div>
    <% elsif(@event!=nil) %>
        
        <%= link_to exposed_products_event_path(@event) do%>
            <%= image_tag("/back.png") %>
        <% end %>
        </div>
        <div id="textBack">
          Back to products of the event
        </div>
        
    <% end %>

    </div>